<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Location</title>
  </head>
  <body>
    <h1>Location</h1>
    <button id="btn">点我一下</button>

    <script>
      var btn = document.getElementById("btn");
      btn.onclick = function () {
        console.log(location);
        // location = "http://www.baidu.com";
        location.reload(true); // true强制清空缓存，刷新页面
      };
    </script>
  </body>
</html>
